@use "sass:math";
@import "../../css/variables";

.docs-index-main {
  display: flex;

  h2 {
    margin: 0;
    padding-bottom: $spacer * 2;
  }
}

.docs-index-aside-main {
  position: sticky;
  top: $spacer * 6;

  @media (max-width: $md) {
    display: none;
  }
}

.docs-index-aside-content {
  border-top: 1px solid $gray-300;
}

.docs-index-toc {
  margin-top: $spacer * 2;
  width: 17rem;
  max-height: calc(100vh - #{$spacer * 13.5} + 1px);
  overflow-y: auto;

  ul {
    list-style-type: none;
    padding-left: 0;
    margin-top: 0;

    li {
      padding: math.div($spacer, 3) 0;

      &:first-child {
        padding-top: 0;
      }
    }
  }
}

.docs-index-content {
  margin-left: $spacer * 2.5;

  @media (max-width: $md) {
    margin-left: 0;
  }

  h2 {
    margin-bottom: 0;
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;

    .docs-index-content-heading {
      display: none;
      flex: 1;

      @media (max-width: $md) {
        display: inline-block;
        margin-right: $spacer * 2;
      }
    }

    .docs-index-content-heading-right {
      font-size: $font-size-base;
      display: flex;
      justify-content: space-between;
      align-items: baseline;
      min-height: 3.4rem;
      padding-top: 0.875rem;
      flex: 1;

      @media (max-width: $md) {
        justify-content: flex-end;
      }

      @media (max-width: $sm) {
        justify-content: flex-start;
      }

      & > * {
        margin-right: $spacer * 2;
        white-space: nowrap;
      }

      & > *:last-child {
        margin-right: 0;
      }

      a {
        text-decoration: none;
        color: $gray-600;

        .feather {
          margin: 0 0.25em 0.25em 0;
          height: 1rem;
        }
      }

      a:hover {
        text-decoration: underline;
        color: $primary;
      }
    }

    .docs-index-content-version {
      font-size: $font-size-base * 1.25;

      a {
        color: $gray-700;
      }

      .dropdown-menu {
        font-size: $font-size-base;
        font-weight: 300;

        a:hover {
          color: $gray-700;
          text-decoration: none;
        }
      }
    }
  }
}

.docs-index-section {
  border-top: 1px solid $gray-300;
  margin-top: $spacer * 4;
  padding-top: $spacer * 2;
  display: flex;
  flex-direction: row;

  @media (max-width: $lg) {
    flex-direction: column;
  }

  &:first-of-type {
    margin-top: 0;
  }

  .docs-index-section-header {
    h3 {
      margin: 0;
      font-size: $font-size-small;
      text-transform: uppercase;
      font-weight: 400;
    }

    svg {
      stroke: $gray-700;
      margin-right: math.div($spacer, 2);

      &.no-stroke {
        stroke: none;
      }
    }
  }

  .docs-index-section-part {
    display: flex;
    flex-direction: column;

    h3 {
      margin: $spacer 0 0 0;
      font-size: 1.5rem;
      line-height: 1.4;
      display: flex;
      justify-content: space-between;
      align-items: flex-start;

      a {
        &:hover {
          text-decoration: none;
        }
      }

      .docs-index-section-part-label {
        margin-top: math.div($spacer, 4);
        margin-left: math.div($spacer, 3) * 2;

        @media (max-width: $xl) {
          margin-left: 0;
        }

        @media (max-width: $lg) {
          margin-left: math.div($spacer, 3) * 2;
        }
      }

      @media (max-width: $xl) {
        flex-direction: column;
      }

      @media (max-width: $lg) {
        flex-direction: row;
      }
    }

    .docs-index-section-content-summary {
      flex: 1;
    }
  }

  .docs-index-section-content {
    display: grid;
    grid-gap: $spacer * 2 $spacer * 1.5;
    flex: 1;
  }

  .docs-index-section-content-2 {
    grid-template-columns: 1fr 1fr;

    @media (max-width: $lg) {
      grid-template-columns: 1fr;
    }
  }

  .docs-index-section-book {
    margin-top: 2rem;
    margin-left: auto;
    margin-right: auto;

    @media (min-width: $lg) {
      margin: 0 0 -2rem 2rem;
    }

    img {
      box-shadow: $button-box-shadow;
      margin-bottom: 0.25rem;
    }

    .external-link-icon {
      margin-bottom: 0.25rem;
    }
  }
}
